package com.jfm.jfmm.collector.entity.device;

import cn.hutool.core.lang.Dict;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author DYang
 * @since 2024-10-14 23:01
 */
@Data
public class CollectDevice {

    /**
     * 设备列表
     */
    private List<Device> devices;

    /**
     * 从配置文件中读取配置信息
     * @param ymlDicts
     * @return
     */
    public static List<CollectDevice> buildCollectDevices(List<Dict> ymlDicts) {
        if (ymlDicts == null) return null;
        List<CollectDevice> devices = new ArrayList<>(8);
        for (Dict dict : ymlDicts) {
            CollectDevice collectDevice = dict.toBean(CollectDevice.class);
            devices.add(collectDevice);
        }
        return devices;
    }

}
